#include <iostream>
#include <cmath>

using namespace std;


double calcPayment (double L,double r,int N)
{
	double M;
	M = L / ( ( 1 - 1 / pow(1 + r, N) ) / r);
	return M;
}
void HomeEquityLoanPayment ()
{
double M;
double r;
double L;
int N;

cout<<"Welcome to the Home Equity Loan Payment Calculator"<<endl;
cout<<"Programmed by Spiros Vangelatos"<< endl;
cout<<"Is the value of the home greater than the outstanding mortgage balance?"<<endl;
cout<<"A bank would not issue a home equity loan if the mortgage debt outstanding"<<endl;
cout<<"is greater than the home's equity. There wouldn't be sufficient collateral"<<endl;
cout<<"to underwrite the loan."<<endl;
cout<<"Investing in real estate when prices are way above their historical moving average"<<endl;
cout<< "is not recommended."<<endl;
cout<<"Loan Amount:"<<endl;
cin>>L;
cout<<"Monthly Interest Rate:"<< endl;
cin>>r;
cout<<" Home Equity Loan Period in Months:"<<endl;
cin>>N;
M = calcPayment (L,r,N);
cout<<"The custom calcPayment() function returned:"<< M << endl;

system("Pause");

}

